package com.rzico.order.enumx;

/**
 * Created by icssh on 2020/4/11.
 */
public enum ShippingMethodEnum {
    /**
     * 订单配送状态(0.普通快递,1.到店核销,2.同城配送)
     */
    SHIPPING_METHOD_EXPRESS(0, "普通快递"),
    SHIPPING_METHOD_SHOP(1, "到店核销"),
    SHIPPING_METHOD_SAMECITY(2, "同城配送");

    private Integer id;
    private String name;

    ShippingMethodEnum(Integer id, String name) {
        this.id = id;
        this.name = name;
    }

    public Integer getId() {
        return this.id;
    }

    public String getName() {
        return this.name;
    }

    public static String getNameById(Integer id){
        if (id == null) {
            return null;
        }
        ShippingMethodEnum anEnum = getById(id);
        if (anEnum == null) {
            return null;
        }
        return anEnum.getName();
    }

    public static ShippingMethodEnum getById(Integer id) {
        for (ShippingMethodEnum anEnum : values()) {
            if (anEnum.getId().equals(id)) {
                return anEnum;
            }
        }
        return null;
    }

}
